﻿using Lightworks.Core.Constant;
using Microsoft.AspNetCore.Mvc;

namespace Lightworks.Api.Controllers
{
    public class ApiBaseController: ControllerBase
    {
        protected ApiResult Ok(object? data)
        {
            return new ApiResult
            {
                Code = HttpStatus.SUCCESS,
                Data = data
            };
        }
        protected ApiResult Ok(string message="", object? data=null) 
        {
            return new ApiResult 
            {
                Code = HttpStatus.SUCCESS,
                Message = message,
                Data = data
            };
        }
        protected ApiResult Fail400(string message="", object? data=null) 
        {
            return new ApiResult { 
                Code = HttpStatus.BAD_REQUEST, 
                Message=message
            };
        }
        protected ApiResult Fail401(string message = "", object? data = null)
        {
            return new ApiResult
            {
                Code = HttpStatus.UNAUTHORIZED,
                Message = message,
                Data = data
            };
        }

        protected ApiResult Fail403(string message = "", object? data = null)
        {
            return new ApiResult
            {
                Code = HttpStatus.FORBIDDEN,
                Message = message,
                Data = data
            };
        }

        protected ApiResult Error(string message = "") 
        {
            return new ApiResult
            {
                Code = HttpStatus.FORBIDDEN,
                Message = message,
                
            };
        }
    }
}
